package nl.hva.three2learn.ui
{
	import flash.media.Camera;
	import flash.media.Video;

	import flash.net.NetStream;

	import mx.core.UIComponent;

	import spark.components.Group;
	import spark.components.supportClasses.SkinnableComponent;

	public class VideoContainer extends SkinnableComponent
	{
		[SkinPart(required="true")]
		public var videoContainer:Group;
	
		private var _video:Video;

		public function VideoContainer()
		{
			super();

			_video = new Video();
			
			setStyle("skinClass", VideoContainerSkin);
		}

		public function attachCamera(camera:Camera):void
		{
			_video.attachCamera(camera);
		}
		
		public function attachNetStream(ns:NetStream):void
		{
			_video.attachNetStream(ns);
		}

		override protected function createChildren():void
		{
			super.createChildren();
			
			var container:UIComponent = new UIComponent();
			container.addChild(_video);
			
			videoContainer.addElement(container);
		}

		public function get video():Video
		{
			return _video;
		}
	}
}
